<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@include file="/WEB-INF/pages/common/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <%@include file="/WEB-INF/pages/common/head.jsp"%>
    <title><spring:message code="title.user"/></title>
    <script type="text/javascript">
        var message =parent.message;
        function manageForm(){
            var isV =$("#tableForm").form("validate");
            if(!isV) return;
            imonJYRH.showZone();
        	var data= imonJYRH.serializeObject($("#tableForm *"));
        	var url ="${path}/sys/user/ajaxSetUserRoles.do";
            $.ajax({
                url : imonJYRH.url(url),
                data : data,
                success : function(reMsg) {
                    if(reMsg.success){
                        parent.returnResult();
                        message.show({ msg : reMsg.msg,title : '<spring:message code='msg.tip'/>',showType:'slide'});
                    }else{
                        if(!imonJYRH.isBlank(reMsg.obj)){
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['obj']);
                        }else{
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['msg']);
                        }
                    }
                    imonJYRH.hideZone();
                }
            });
        }
        $(document).ready(function(){
        	$("#roles").combogrid({
                panelWidth:440,
                multiple: true,  
                idField:'id',
                textField:'name',
                fitColumns:true,
                nowrap:true,
                url:"${path}/sys/role/ajaxList.do",
                frozenColumns:[[
                    {field:'id',title:'ID',width:100,checkbox:true}
                ]],
                columns:[[
                    {field:'code',title:'编码',width:100},
                    {field:'name',title:'名称',width:120}
                ]]
            });
           $("#roles").combogrid('setValue', '${ids }');  
        });
    </script>
</head>
<body>
<table class="tableForm" id="tableForm" width="100%">
    <tr>
        <td align="right"><span style="color:red;">*</span><spring:message code='label.user.code'/>:</td>
        <td align="left">
        	<input type="hidden" name="id" value="${user.id }">
            <input type="text" name="code" class="easyui-validatebox disable-input" data-options="required:true"  
            	value="${user.code }" readonly="readonly">
        </td>
    </tr>
    <tr>
        <td align="right"><span style="color:red;">*</span><spring:message code='label.user.name'/>:</td>
        <td align="left">
            <input type="text" name="name" value="${user.name}" readonly="readonly" 
                class="easyui-validatebox disable-input" data-options="required:true">
        </td>
    </tr>
    <tr>
        <td align="right"><spring:message code='label.user.phone'/>:</td>
        <td align="left">
            <input id="roles" type="text" name="list" style="width: 145px"/>
        </td>
    </tr>
</table>
</body>
</html>